# random模块是python的一个标准库，
# 里面提供了一些随机数生成的方法
from random import randint

count_dict = {}
for count in range(100):
    # 生成一个1~20的随机数，不包括20
    i = randint(1, 20)
    print(i)
    if i in count_dict:
        count_dict[i] += 1
    else:
        count_dict[i] = 1

count_sorted = sorted(count_dict.items(), key=lambda d: d[1], reverse=True)
print(count_sorted)
